<template>
	<view class="u-rela">
		<view class="module-content" v-if="dataList.length>0">
			
			<view class="module-block" v-for="(item,index) in dataList" :key="index">
				<view class="block" style="border-bottom: 1px solid #eee;padding-bottom:20rpx;margin-bottom: 24rpx;">
				
				<view>答题用时：{{item.answer_time}}</view>
				
				<view>得分：<span class="count" style="color: #3D7EEA;">{{item.total_score}}</span></view></view>
				<view class="block">
					<view class="item">
						<view class="count">{{item.question_num}}</view>
						<view class="title">答题数量</view>
					</view>
					<view class="item">
						<view class="count">{{item.correct}}</view>
						<view class="title">正确数量</view>
					</view>
<!-- 					<view class="item">
						<view class="count">{{item.wrong}}</view>
						<view class="title">错误数量</view>
					</view> -->
				</view>
				
			</view>
		</view>
		<view v-else style="text-align: center;color: #999;padding: 200rpx;">暂无记录！</view>
		<!-- #ifdef MP-WEIXIN -->
		<ws-wx-privacy id="privacy-popup"></ws-wx-privacy>
		<!-- #endif -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				curIndex: 0,
				isLogin: false,
				userinfo: {},
				dataList: []
			}
		},
		onLoad() {

		},
		onShow() {
			this.curIndex=0
			this.dataList=[]
			this.userinfo={}
			if (this.$db.get('userToken')) {
				this.getUserInfo()
			} else {
				this.isLogin = false;
			}

			//#ifdef MP-WEIXIN
			wx.requirePrivacyAuthorize({
				success: () => {
					console.log('点击同意');
				},
				fail: () => {
					console.log('点击拒绝');

				},
				complete: () => {
					console.log('用户已点击');
				}
			})
			//#endif
		},
		methods: {
			toLogin() {
				uni.navigateTo({
					url: '/pages/login/index'
				})
			},
			toList() {
				uni.navigateTo({
					url: '/pages/index/list'
				})
			},
			getUserInfo() {

				this.$api.answerRecord({}, res => {
					if (res.code==1) {
						this.isLogin = true;
						this.dataList = res.data;
					}
				})
			},
		}
	}
</script>

<style>
	.module-content {
		padding: 30rpx;
	}

	.userinfo {
		box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.25);
		background: #fff;
		border-radius: 20rpx;
	}

	.hd {
		background: rgba(210, 210, 255, 0.8);
		width: 88rpx;
		height: 88rpx;
		border-radius: 50%;
	}
</style>

<style lang="scss">
	.u-reset-button{

		font-size: 28rpx;
		background: linear-gradient(90deg, #3D7EEA 8.12%, #02B0F1 95.73%);
		color: #fff;
		height: 90rpx;
		width: 500rpx;
		margin: 0 auto;
		line-height: 90rpx;
		border-radius: 50rpx;
		margin-top: 20rpx;
	}
	.module-block{
		box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.25);
		background: #fff;
		border-radius: 20rpx;
		padding:30rpx;
		margin-bottom:30rpx;
		.block{
		display: flex;
		align-items: center;
		justify-content: space-between;
			
		}
		.item{
			width:50%;
			text-align: center;
		}
		.title{
			font-size: 26rpx;
			margin-top: 6rpx;
		}
		.count{
			font-size: 50rpx;
			font-weight: bold;
			
		}
	}
</style>